<template>
	<view class="body">
		<view class="sumData">
			<view class="sumMoneny">
				<view class="money-title">
					<text>收入累计(元)</text>
				</view>
				<view class="money-number">
					¥<span>{{ earnList.total }}</span>
				</view>
			</view>
			<view class="data-container">
				<view class="money-title">
					<view>本月确认收货</view>
					<view>¥<span>{{ earnList.finishOrder }}</span></view>
				</view>
				<view class="money-title">
					<view>上月确认收货</view>
					<view>¥<span>{{ earnList.lastMonthFinishOrder }}</span></view>
				</view>
				<!-- <view class="money-title">
					<view>待确认收货</view>
					<view>¥<span>160.26</span></view>
				</view> -->
			</view>
		</view>
		<view class="promt">
			<text>每月25号可提现上月确认收货的订单收入</text>
		</view>

		<view class="account-container">
			<view class="account-title">
				今日概况
			</view>
			<!-- <view class="account-more" @click="gourl('../historyEarn/historyEarn')">
				历史概况 <u-icon name="arrow-right"></u-icon>
			</view> -->
		</view>
		<view class="todayData whiteBg">
			<view class="dsa">
				<view class="dsc">
					<view class="money-title">预估收入</view>
					<view class="whiteBg-text" style="color:#D52631;">¥{{ earnList.todayIncome}}</view>
				</view>
				<view class="dsc">
					<view class="money-title">下单订单数</view>
					<view class="whiteBg-text">{{ earnList.todayOrder}}</view>
				</view>
			</view>
			<view class="money-title" style="text-align:right;" @click="gourl('../earnDetail/earnDetail')">
				查看详情
			</view>
		</view>

		<view class="account-container">
			<view class="account-title">
				本月概况
			</view>
			<!-- <view class="account-more">
				历史概况 <u-icon name="arrow-right"></u-icon>
			</view> -->
		</view>
		<view class="todayData whiteBg">
			<view class="dsa">
				<view class="dsc">
					<view class="money-title">预估收入</view>
					<view class="whiteBg-text" style="color:#D52631;">¥{{ earnList.monthIncome}}</view>
				</view>
				<view class="dsc">
					<view class="money-title">下单订单数</view>
					<view class="whiteBg-text">{{ earnList.monthOrder}}</view>
				</view>
			</view>
			<view class="money-title" style="text-align:right;" @click="gourl('../monthEarn/monthEarn')">
				查看详情
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			earnList:[],
			login: false,
			userInfo: {}
		};
	},
	onLoad() {
		let userinfo = uni.getStorageSync('userinfo');
		if (userinfo) {
			this.login = true;
		}
		this.getUserDetail()
		this.getEarn()
	},
	methods: {
		getEarn() {
			this._post_form('api/ykjp/sell/sell/myIncome', {}, (res) => {
				if (res.code == 1) {
					
					this.earnList = res.data.data
					
				}
			})
		},
		getUserDetail() {
			var _this = this;
			_this._post_form('api/user/getUserDetail', {}, function (result) {
				_this.setData({
					userInfo: result.data
				})
			});
		},
		gourl(url) {
			if (this.login) {
				uni.navigateTo({
					url: url
				});
			} else {
				uni.navigateTo({
					url: 'login'
				});
			}
		},
	}
}
</script>

<style lang="scss">
.whiteBg-text {
	font-size: 40rpx;
	font-weight: 500;
}

.whiteBg {
	background-color: #fff;
	border-radius: 20rpx;
	margin-top: 20rpx;
	padding: 20rpx;
}

.account-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 30rpx;

	.account-title {
		font-size: 28rpx;
		font-weight: 600;

	}

	.account-more {
		font-size: 26rpx;
		display: flex;
		color: #3D3D3D;

	}
}

.data-container {
	display: flex;
	align-items: center;
	justify-content: space-around;
	padding-bottom: 30rpx;
}

.body {
	background-color: #F4F5F7;
	padding: 20rpx;
	height: 100vh;

	.money-title {
		text-align: center;
		color: #9A9A9A;
		font-size: 12px;

		span {
			font-size: 40rpx;
			font-weight: 500;
			color: #3D3D3D;

		}
	}

	.money-number {
		font-weight: 500;

		color: #FD0001;

		span {
			font-size: 40rpx;
		}
	}

	.sumData {
		background-color: #fff;
		border-radius: 20rpx 20rpx 0 0;

		.sumMoneny {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			padding: 20rpx;

		}
	}

	.promt {
		background-color: #FEEEEF;
		color: #D52631;
		padding: 20rpx;
		border-radius: 0 0 20rpx 20rpx;
		border-radius: 0 0 20rpx 20rpx;

		text {
			font-size: 28rpx;
		}
	}
}</style>
